package com.xxx.modules.controller;;
import com.xxx.modules.service.CategroyService;
import com.xxx.modules.entity.Categroy;
import com.xxx.modules.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import com.github.pagehelper.PageInfo;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.xxx.modules.utils.Result;
import com.xxx.modules.utils.ResultUtil;
import com.xxx.modules.utils.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * 类型
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2024-03-30
 */
@RestController
@RequestMapping("/common/categroy")
@Api(tags="类型")
public class CategroyController {
    @Autowired
    private CategroyService categroyService;

    /**
    *  获取所有类型
    * @param pageNum
    * @param pageSize
    * @param categroy
    * @return
    */

    @GetMapping("/getCategroyList")
    @ApiOperation("获取所有类型")
    public Result getCategroyList(Categroy categroy, @RequestParam(value="pageNum",defaultValue = "1") Integer pageNum,
                                      @RequestParam(value="pageSize",defaultValue = "10") Integer pageSize){
        return categroyService.selectCategroyList(categroy,pageNum,pageSize);
    }


    @GetMapping("/getCategroyInfo")
    @ApiOperation("根据id获取单个类型")
    public Result getCategroyInfo(Integer id){
        return categroyService.selectCategroyInfo(id);
    }

    /**
    * 保存类型
    * @param categroy
    * @return
    */
    @PostMapping("/saveCategroyInfo")
    @ApiOperation("保存类型")
    public Result saveCategroyInfo(@RequestBody Categroy categroy){
        return categroyService.saveCategroyInfo(categroy);
    }


    /**
     * 更新类型
     * @param categroy
     * @return
     */

    @PutMapping("/updateCategroyInfo")
    @ApiOperation("更新类型")
    public Result updateCategroyInfo(@RequestBody Categroy categroy){
        return categroyService.updateCategroyInfo(categroy);
    }

    /**
     * 根据id删除类型
     * @param id
     * @return
     */
    @DeleteMapping("/delCategroyInfo")
    @ApiOperation("根据id删除类型")
    public Result delCategroyInfo(Integer id){
        return categroyService.delCategroyInfo(id);
    }

    /**
     * 根据id集合批量删除类型
     * @param idList
     * @return
     */
    @DeleteMapping("/delBatchCategroyInfo")
    @ApiOperation("根据id集合批量删除类型")
    public Result delBatchCategroyInfo(String idList){
        return categroyService.delBatchCategroyInfo(idList);
    }










}